home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / edit / ced_programs.lha / CED-Programs / LeftShift.ced < prev    next >
Text File  |  1993-02-14  |  1KB  |  66 lines

  1. /*
  2.  * LeftShift.ced
  3.  *
  4.  * Shift the current block to the left, according to tabsize setting.
  5.  *
  6.  * Author: Stefan Winterstein (winter@cs.uni-sb.de)
  7.  * Status: Public Domain
  8.  *
  9.  */
  10.  
  11. LF  = '0A'X
  12. TAB = '09'X
  13.  
  14. options results        /* Allow CygnusEd to pass status variables */
  15.  
  16. address 'rexx_ced'    /* Tell ARexx to talk to CygnusEd */
  17.  
  18. status 8
  19. tabsize = result
  20. if (tabsize < 1) & (tabsize > 10) then do
  21.     okay1 "Cannot shift with that Tab size."
  22.     exit
  23. end
  24.  
  25. status 47            /* get current line number */
  26. start = result
  27.  
  28. status 69            /* get start of block */
  29.     end = result
  30.  
  31. if end = -1 then do    /* No block marked */
  32.     end = start+1    /* then work on current line */
  33. end
  34.  
  35. if start > end then do    /* swap start with end */
  36.     t = start
  37.     start = end
  38.     end = t
  39. end
  40.  
  41. 'jump to line' start+1    /* goto start of block */
  42. 'beg of line'
  43.  
  44. do line = start while line < end
  45.     'beg of line'
  46.     'delete'
  47.     status 65
  48.     character = result
  49.     if (character  = ' ') then do
  50.         do for tabsize-1
  51.             'delete'
  52.         end
  53.         'down'
  54.     end
  55.     else
  56.         if (character  ~= TAB) then do
  57.             'undo'
  58.             if (character ~= LF) then 'down'
  59.         end
  60.         else 'down'
  61. end
  62.  
  63. 'beg of line'
  64.  
  65. exit
  66.